﻿using Transformable_Engine_v2.Engine.Graphics;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Transformable_Engine_v2.Engine.GameObjects.Primitives
{
    public class GridPrimitive : PolygonPrimitive
    {
        public GridPrimitive(TE_Rectangle area, int cellSize, Color color)
        {
            DrawType = LineDrawType.Lines;

            for(int x = 0; x <= area.Width; x += cellSize) 
            {
                AddVertex(new Vertex(x + area.X, area.Y, color));
                AddVertex(new Vertex(x + area.X, area.Y + area.Height, color));
            }

            for(int y = 0; y <= area.Height; y += cellSize) 
            {
                AddVertex(new Vertex(area.X, y + area.Y, color));
                AddVertex(new Vertex(area.X + area.Width, y + area.Y, color));
            }
        }
    }
}